// 学生提交的作业内容
import express from 'express';
import pool from "../importantApi/db_connection.js";

const router = express.Router();
router.get('/', async (req, res) => {
    const {doworkId} = req.query;
    if (!doworkId) {
        return res.status(401).json({
            code: 401,
            msg: "缺少必要参数"
        })
    }
    try {
        let [result] = await pool.query(`
            select *
            from dowork
            where dowork_id = '${doworkId}'
        `)
        return res.status(200).json({
            code: 200,
            data: result[0]
        })
    } catch (err) {
        console.log(err)
        res.status(500).json({
            code: 500,
            error: err,
            msg: "作业获取错误：server error"
        })
    }
})
export default router;